load("@rules_python//python:defs.bzl", "py_library", "py_test")
load("@tink_py_pip_deps//:requirements.bzl", "requirement")

package(default_visibility = ["//:__subpackages__"])

licenses(["notice"])

py_library(
    name = "signature",
    srcs = ["__init__.py"],
    srcs_version = "PY3",
    visibility = ["//visibility:public"],
    deps = [
        ":_public_key_sign",
        ":_public_key_verify",
        ":_signature_key_manager",
        ":_signature_key_templates",
    ],
)

py_library(
    name = "_public_key_sign",
    srcs = ["_public_key_sign.py"],
    srcs_version = "PY3",
)

py_library(
    name = "_public_key_verify",
    srcs = ["_public_key_verify.py"],
    srcs_version = "PY3",
)

py_library(
    name = "_signature_key_manager",
    srcs = ["_signature_key_manager.py"],
    srcs_version = "PY3",
    deps = [
        ":_public_key_sign",
        ":_public_key_verify",
        ":_signature_wrapper",
        "//tink/cc/pybind:tink_bindings",
        "//tink/core",
        "//tink/proto:tink_py_pb2",
    ],
)

py_test(
    name = "_signature_key_manager_test",
    srcs = ["_signature_key_manager_test.py"],
    srcs_version = "PY3",
    deps = [
        ":signature",
        requirement("absl-py"),
        "//tink:tink_python",
        "//tink/core",
        "//tink/proto:common_py_pb2",
        "//tink/proto:ecdsa_py_pb2",
        "//tink/proto:tink_py_pb2",
    ],
)

py_library(
    name = "_signature_wrapper",
    srcs = ["_signature_wrapper.py"],
    srcs_version = "PY3",
    deps = [
        ":_public_key_sign",
        ":_public_key_verify",
        requirement("absl-py"),
        "//tink/core",
        "//tink/proto:tink_py_pb2",
    ],
)

py_test(
    name = "_signature_wrapper_test",
    srcs = ["_signature_wrapper_test.py"],
    srcs_version = "PY3",
    deps = [
        ":signature",
        requirement("absl-py"),
        "//tink:tink_python",
        "//tink/testing:keyset_builder",
    ],
)

py_library(
    name = "_signature_key_templates",
    srcs = ["_signature_key_templates.py"],
    srcs_version = "PY3",
    deps = [
        "//tink/internal:big_integer_util",
        "//tink/proto:common_py_pb2",
        "//tink/proto:ecdsa_py_pb2",
        "//tink/proto:rsa_ssa_pkcs1_py_pb2",
        "//tink/proto:rsa_ssa_pss_py_pb2",
        "//tink/proto:tink_py_pb2",
    ],
)
